package lego.Moving;

import lejos.nxt.Button;
import lejos.nxt.LCD;
import lejos.util.Delay;
import lego.BT.BTController;
import lego.jbv.*;

public class Stop implements Behavior{
	private BTController btcontroller;
	
	public Stop(BTController btcontroller)
	{
		this.btcontroller = btcontroller;
	}
	
	@Override
	public int takeControl() {
		if(Button.ESCAPE.isDown()) {
			return 101;}
		else if(btcontroller.died())
		{
			Car.stop();
			Delay.msDelay(5000);
			System.exit(0);
		}
		return 0;
	}

	@Override
	public void action() {
		Car.stop();
		Display.setStatus("Exiting");
		Delay.msDelay(2000);
		
		System.exit(0);
	}

	@Override
	public void suppress() {
		// TODO Auto-generated method stub
		
	}
	

}
